import matplotlib
import matplotlib.pyplot as plt
import pandas as pd
k=10
matplotlib.rcParams['font.family'] = 'SimHei'
# # 读取 Excel 文件中的数据
# df = pd.read_excel('output/diploma.xlsx', sheet_name='base')
# # 删除第一列
# df = df.iloc[1:, 1:]
# y1_deg_influence = []
# y2_deg_influence = []
# y3_deg_influence = []
# y1_PR_influence = []
# y1_PRTH_influence = []
# y1_PRDD_influence = []
# y2_PR_influence = []
# y2_PRTH_influence = []
# y2_PRDD_influence = []
# y3_PR_influence = []
# y3_PRTH_influence = []
# y3_PRDD_influence = []
#
# for i in range(5):
#     data = df.iloc[i, 0]
#     y1_deg_influence.append(data)
#
# for i in range(5):
#     data = df.iloc[i, 1]
#     y1_PR_influence.append(data)
#
# for i in range(5):
#     data = df.iloc[i, 2]
#     y1_PRTH_influence.append(data)
#
# for i in range(5):
#     data = df.iloc[i, 3]
#     y1_PRDD_influence.append(data)
#
# for i in range(5):
#     data = df.iloc[i, 4]
#     y2_deg_influence.append(data)
#
# for i in range(5):
#     data = df.iloc[i, 5]
#     y2_PR_influence.append(data)
#
# for i in range(5):
#     data = df.iloc[i, 6]
#     y2_PRTH_influence.append(data)
#
# for i in range(5):
#     data = df.iloc[i, 7]
#     y2_PRDD_influence.append(data)
#
# for i in range(5):
#     data = df.iloc[i, 8]
#     y3_deg_influence.append(data)
#
# for i in range(5):
#     data = df.iloc[i, 9]
#     y3_PR_influence.append(data)
#
# for i in range(5):
#     data = df.iloc[i, 10]
#     y3_PRTH_influence.append(data)
#
# for i in range(5):
#     data = df.iloc[i, 11]
#     y3_PRDD_influence.append(data)
#
x = [1 * k, 2 * k, 3 * k, 4 * k, 5 * k]
#
# # 第一组图
# fig, axs = plt.subplots(1, 1, figsize=(10, 5))
# fig.suptitle('基于社区划分的影响力最大化研究')

# # 第一个子图
# axs.plot(x, y1_deg_influence, marker='x', markersize=8, linestyle='-', label='Deg')
# axs.plot(x, y1_PR_influence, marker='o', markersize=8, linestyle='-', label='PageRank')
# axs.plot(x, y1_PRTH_influence, marker='s', markersize=8, linestyle='-', label='PRCP')
# axs.plot(x, y1_PRDD_influence, marker='^', markersize=8, linestyle='-', label='PRDCP')
# axs.set_xlabel('种子节点数量')
# axs.set_ylabel('影响力')
# axs.set_title('Email数据集')
# axs.legend()
# plt.show()
# fig.savefig("output/base_email.png")
# 第二个子图
# axs.plot(x, y2_deg_influence, marker='x', markersize=8, linestyle='-', label='Deg')
# axs.plot(x, y2_PR_influence, marker='o', markersize=8, linestyle='-', label='PageRank')
# axs.plot(x, y2_PRTH_influence, marker='s', markersize=8, linestyle='-', label='PRCP')
# axs.plot(x, y2_PRDD_influence, marker='^', markersize=8, linestyle='-', label='PRDCP')
# axs.set_xlabel('种子节点数量')
# axs.set_ylabel('影响力')
# axs.set_title('Marvel数据集')
# axs.legend()
# plt.show()
# fig.savefig("output/base_marvel.png")
# axs.plot(x, y3_deg_influence, marker='x', markersize=8, linestyle='-', label='Deg')
# axs.plot(x, y3_PR_influence, marker='o', markersize=8, linestyle='-', label='PageRank')
# axs.plot(x, y3_PRTH_influence, marker='s', markersize=8, linestyle='-', label='PRCP')
# axs.plot(x, y3_PRDD_influence, marker='^', markersize=8, linestyle='-', label='PRDCP')
# axs.set_xlabel('种子节点数量')
# axs.set_ylabel('影响力')
# axs.set_title('Github数据集')
# axs.legend()
# plt.show()
# fig.savefig("output/base_github.png")
# 读取 Excel 文件中的数据
df = pd.read_excel('output/diploma.xlsx', sheet_name='COBase')
fig, axs = plt.subplots(1, 1, figsize=(10, 5))
# 删除第一列
df = df.iloc[1:, 1:]
y1_COdeg_influence = []
y2_COdeg_influence = []
y3_COdeg_influence = []
y1_COPR_influence = []
y1_COPRTH_influence = []
y1_COPRDD_influence = []
y2_COPR_influence = []
y2_COPRTH_influence = []
y2_COPRDD_influence = []
y3_COPR_influence = []
y3_COPRTH_influence = []
y3_COPRDD_influence = []

for i in range(5):
    data = df.iloc[i, 0]
    y1_COdeg_influence.append(data)

for i in range(5):
    data = df.iloc[i, 1]
    y1_COPR_influence.append(data)

for i in range(5):
    data = df.iloc[i, 2]
    y1_COPRTH_influence.append(data)

for i in range(5):
    data = df.iloc[i, 3]
    y1_COPRDD_influence.append(data)

for i in range(5):
    data = df.iloc[i, 4]
    y2_COdeg_influence.append(data)

for i in range(5):
    data = df.iloc[i, 5]
    y2_COPR_influence.append(data)

for i in range(5):
    data = df.iloc[i, 6]
    y2_COPRTH_influence.append(data)

for i in range(5):
    data = df.iloc[i, 7]
    y2_COPRDD_influence.append(data)

for i in range(5):
    data = df.iloc[i, 8]
    y3_COdeg_influence.append(data)

for i in range(5):
    data = df.iloc[i, 9]
    y3_COPR_influence.append(data)

for i in range(5):
    data = df.iloc[i, 10]
    y3_COPRTH_influence.append(data)

for i in range(5):
    data = df.iloc[i, 11]
    y3_COPRDD_influence.append(data)

# # 第一个子图
# axs.plot(x, y1_COdeg_influence, marker='x', markersize=8, linestyle='-', label='CoDeg')
# axs.plot(x, y1_COPR_influence, marker='o', markersize=8, linestyle='-', label='CoPageRank')
# axs.plot(x, y1_COPRTH_influence, marker='s', markersize=8, linestyle='-', label='CoPRCP')
# axs.plot(x, y1_COPRDD_influence, marker='^', markersize=8, linestyle='-', label='CoPRDCP')
# axs.set_xlabel('种子节点数量')
# axs.set_ylabel('影响力')
# axs.set_title('Email数据集')
# axs.legend()
# plt.show()
# fig.savefig("output/CoBase_email.png")
# 第二个子图
# axs.plot(x, y2_COdeg_influence, marker='x', markersize=8, linestyle='-', label='CoDeg')
# axs.plot(x, y2_COPR_influence, marker='o', markersize=8, linestyle='-', label='CoPageRank')
# axs.plot(x, y2_COPRTH_influence, marker='s', markersize=8, linestyle='-', label='CoPRCP')
# axs.plot(x, y2_COPRDD_influence, marker='^', markersize=8, linestyle='-', label='CoPRDCP')
# axs.set_xlabel('种子节点数量')
# axs.set_ylabel('影响力')
# axs.set_title('Marvel数据集')
# axs.legend()
# plt.show()
# fig.savefig("output/CoBase_marvel.png")
# 第三个子图
axs.plot(x, y3_COdeg_influence, marker='x', markersize=8, linestyle='-', label='CoDeg')
axs.plot(x, y3_COPR_influence, marker='o', markersize=8, linestyle='-', label='CoPageRank')
axs.plot(x, y3_COPRTH_influence, marker='s', markersize=8, linestyle='-', label='COPRCP')
axs.plot(x, y3_COPRDD_influence, marker='^', markersize=8, linestyle='-', label='COPRDCP')
axs.set_xlabel('种子节点数量')
axs.set_ylabel('影响力')
axs.set_title('Github数据集')
axs.legend()
plt.show()
fig.savefig("output/CoBase_github.png")
# plt.show()

fig.savefig("output/diploma.png")
